package com.zhende.hr.mapper.kqlog;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zhende.hr.entity.KqUser;

@Mapper
public interface KaoQinDao {

	
	@Select("SELECT  t1.per_cdcode as perCdcode, t1.per_name,CONVERT(varchar(100), t2.sou_date, 23) as souDate, MIN(t2.sou_time) AS sbTime,MAX(t2.sou_time) AS xbTime "
			+ "FROM   kqdata.dbo.personal AS t1  "
			+ "JOIN kqdata.dbo.source AS t2 ON t1.per_code = t2.sou_code "
			+ "WHERE CONVERT(varchar(100), t2.sou_date, 23)>=CONVERT(varchar(100),DATEADD(day,-40,GETDATE()), 23)  "
			+ " and t1.per_cdcode = #{perCode} "
			+ "GROUP BY t1.per_cdcode, t1.per_name, t1.per_jw, t1.per_rightbm, t2.sou_date ")
	List<KqUser> getUsers(@Param("perCode")String perCode);

}
